﻿using System.Linq.Expressions;

namespace HomeWork.IDAL
{
    public interface IBaseDal<T>
    {
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="t">实体</param>
        /// <returns>受影响的行数</returns>
        Task<int> AddAsync(T t);
        /// <summary>
        /// 单条件查询
        /// </summary>
        /// <param name="expression">查询条件</param>
        /// <returns>符合条件的行数</returns>
        Task<T> GetAsync(Expression<Func<T, bool>> expression);
        /// <summary>
        /// 获取所有信息
        /// </summary>
        /// <returns>全部数据</returns>
        IQueryable<T> GetList();
        /// <summary>
        /// 删除/修改
        /// </summary>
        /// <param name="t">实体</param>
        /// <returns>受影响的行数</returns>
        Task<int> UpdateAsync(T t);

    }
}
